/*
 * Copyright (C) 2010 Seapeak.Xu
 *
 * fostmq may be copied only under the terms of the GNU General
 * Public License V3, which may be found in the fostmq source kit.
 *
 * Created on: 2010-8-30
 * Author: Seapeak.Xu
 */

#ifndef FOST_PROPREADER_H_
#define FOST_PROPREADER_H_
#ifdef __cplusplus
extern "C" {
#endif


#include <stdio.h>
#include <stdlib.h>

#include "fost_mgnb.h"
#include "fost_typedef.h"

typedef int (*value_setter_callback)(const char *key,const char *value);

/*
 * init the config file
 * args:
 * 	path: the config file path
 * returns
 * 	success : return 0
 * 	fail: return errno or -1(when unkown reason).
 */
int prop_init(char *path, value_setter_callback func);
int set_int(int *result, const char *value, const int initial);
int set_string(char *result, const char *value, const char *initial);
int set_bool(bool *result, const char *value, const bool initial);
int set_double(double *result,const char *value,const double initial);
int set_long(long *result,const char *value,const long initial);

#ifdef __cplusplus
}
#endif
#endif /* PROPREADER_H_ */
